import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path, { join } from 'path'
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
import Components from 'unplugin-vue-components/vite';
import { VantResolver } from 'unplugin-vue-components/resolvers';
import prismjs from "vite-plugin-prismjs";
// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    prismjs({
      languages: ["json", 'javascript', 'js', 'css', 'markup', 'html', 'sql'],
      //  languages: 'all',
      plugins: ["line-numbers"], //配置显示行号插件
      theme: "solarizedlight", //主题名称
      css: true,
    }),
    Components({
      resolvers: [VantResolver()],
    }),
    createSvgIconsPlugin({
      // 指定需要缓存的图标文件夹
      iconDirs: [path.resolve(process.cwd(), 'src/assets/icons')],
      // 指定symbolId格式 (svg组件内设置的#icon-)
      symbolId: 'icon-[name]'
    })
  ],
  // 软连接
  resolve: {
    alias: {
      // 使用@路径
      "@": join(__dirname, '/src')
    }
  },
  // 代理配置
  // server: {
  //   proxy: {
  //     // 指定代理请求
  //     '/api': {
  //       target: '',
  //       changeOrigin: true //跨域
  //     }
  //   }
  // }
})
